#ifndef BLOCKGROUPMOVE_H
#define BLOCKGROUPMOVE_H

#include "blockgroup.h"

/********************************************************
 * @ClassName:  BlockGroupMove
 * @Brief:      能够移动的方块组，接受玩家键盘操控
 * @date        2022/02/11
 ********************************************************/
class BlockGroupMove : public BlockGroup
{
    Q_OBJECT
public:
    explicit BlockGroupMove(const QPointF &point, QObject *parent = nullptr);

    void game_start();                  //游戏开始

    int speed() const;
    void setSpeed(int newSpeed);
    void copyShape(BlockGroup *another);       //拷贝另一个方块组

signals:
    void game_over();                   //游戏结束
    void need_next_shape();             //当前形状已触底

protected:
    virtual void keyPressEvent(QKeyEvent * event);

private:
    enum Direction {
        up = 0,
        down = 1,
        left = 2,
        right = 3,
    };

    int m_speed;            //速度（读取设置）

    QTimer *timer;
    void move_one_step(Direction direction);

};

#endif // BLOCKGROUPMOVE_H
